using System;
using System.Linq;
using System.ServiceModel;
using System.Runtime.Serialization;

namespace ContractDocumentation
{

    [DataContract(Namespace = "http://cz.o2.com/ContractDocumentation")]
    public class SerializedFile
    {
        private string name;

        [DataMember(Order = 0)]
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        private byte[] content;

        [DataMember(Order = 1)]
        public byte[] Content
        {
            get { return content; }
            set { content = value; }
        }
    }

    [DataContract(Namespace = "http://cz.o2.com/ContractDocumentation")]
    public class GeneratorSettings
    {
        private Nullable<Double> scaleFactor;

        [DataMember(Order = 0)]
        public Nullable<Double> ScaleFactor
        {
            get { return scaleFactor; }
            set { scaleFactor = value; }
        }
    }

    [ServiceContract(Name = "ContractDocumentationService", Namespace = "http://cz.o2.com/ContractDocumentation")]
    public interface IContractDocumentationService
    {
        [OperationContract]
        SerializedFile[] GenerateImages(SerializedFile[] ContractFiles, GeneratorSettings GeneratorSettings);
    }

    [ServiceBehavior(Namespace = "http://cz.o2.com/ContractDocumentation")]
    public class ContractDocumentationService : IContractDocumentationService
    {
        public SerializedFile[] GenerateImages(SerializedFile[] ContractFiles, GeneratorSettings GeneratorSettings)
        {
            return Visualizer.GenerateImages(ContractFiles, GeneratorSettings).ToArray();
        }
    }

}
